<?php

namespace app\common\model;

use think\Model;


class ShopGoodsCollection extends Model
{
    // 表名
    protected $name = 'shop_goods_collection';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime =  false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];


    /**
     * 获取是否有收藏该店铺商品
     * @param $shop_id
     * @param $goods_id
     * @param $member_id
     * @return bool
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function getMemberIsCollection($shop_id,$goods_id,$member_id)
    {
        $info = self::where(['shop_id'=>$shop_id,'goods_id'=>$goods_id,'member_id'=>$member_id])->find();
        if ($info){
            return true;
        }else{
            return false;
        }
    }
}
